#pragma once

#include "common_cross.h"

#if defined(__x86_64__) || defined(__aarch64__)

#elif defined(__riscv)

#endif

#define	HOST_MEM 0
#define PRIVATE_MEM 1

const char* MemTypeStr[] = {
	"HOST_MEM",
	"PRIVATE_MEM"
};

#define LOGIT       0
#define LOGIT_ARG   1e-5

#define BOXCOX      1
#define BOXCOX_ARG 0.5

#define ONEHOT      2
#define ONEHOT_LOW  0
#define ONEHOT_HIGH 16
#define ONEHOT_CLASS 8

#define BUCKETIZE   3

#define SIGRID_HASH 4
#define SIGRID_ARG1 0
#define SIGRID_ARG2 10

#define CLAMP_LIST  5
#define CLAMP_ARG1  0
#define CLAMP_ARG2  16

#define NGRAM       6
#define NGRAM_ARG   4

#define FIRSTX      7
#define FIRSTX_ARG  1

#define MAPID       8
#define FILLNULL    9
#define CAST        10

#define EMBEDDING_FETCH 11

// struct operation node, include operation infomation
// espectially for DPA

// 每个DPA线程拿到的结构体信息。
struct __attribute__((__aligned__(64))) DpaThreadInfo{
	void * input_mem_addr; 
	void * output_mem_addr;

	size_t input_mem_offset;
	size_t output_mem_offset;
	
	uint32_t window_id; // all the same? create more windows make sense ?
	uint32_t input_mem_mkey;
	uint32_t output_mem_mkey;
	uint32_t thread_index;

	int preprocess_type; // which operation
	int num_ele_per_feature;
	int output_num_ele_per_feature;
	int stream_id; // for debug
	int thread_num; // for init;

	size_t size;
};


// 分配任务
// mem_addr[0] 接收任务id，mem_addr[1]统计任务完成情况。
struct __attribute__((__aligned__(64))) ThreadControl{
	uint32_t window_id; // all the same? create more windows make sense ?
	uint32_t mem_mkey;
	void * mem_addr;
};

struct external_ptr{
	void * input_mem_addr;
	void * output_mem_addr;
};
